import 'package:flutter_base/src/common/widgets/web_view.dart';
import 'package:flutter_base/src/pages/login/login_page.dart';
import 'package:go_router/go_router.dart';

/// 通用路由
class CommonRoutes {
  /// webView界面
  static const String webViewPath = '/webView';

  /// 登录
  static const String loginPath = '/login';

  /// 路由
  static final List<RouteBase> routes = [
    GoRoute(
      path: webViewPath,
      name: 'web_view_page',
      builder: (context, state) {
        final String? url = state.uri.queryParameters['url'];
        return WebView(url: url ?? '');
      },
    ),
    GoRoute(path: loginPath, name: 'login_page', builder: (context, state) => const LoginPage()),
  ];
}
